/**
 * 获取元素 style 属性值
 */
export default (element?: HTMLElement | null, property?: string): string => {
  if (element) {
    const elementStyle = getComputedStyle(element);
    if (property) {
      const value = elementStyle.getPropertyValue(property);
      if (value.endsWith('px')) {
        return value.slice(0, -2);
      } else {
        return value;
      }
    }
  }
  return '';
};
